#ifndef DEBUG_STREAMS_H_
#define DEBUG_STREAMS_H_
/*********************************************************/
#include <Poco/Mutex.h>

#include <string>
#include <sstream>
/*********************************************************/
class Debug 
{
private:
	static Poco::Mutex*		mutex;			// Multithreading security
	std::ostringstream		debug;			// debug stream where all classes dump their output to
	static Debug& 			pInstance;		// Only available instance of the Debug class

	// Construction / Copy Construction & Assignment
	Debug(){};						// Constructor
	Debug(const Debug&);					// Copy Constructor
	Debug& operator=(const Debug&);				// Assignment operator

public:
	std::string flush();					// Flushes the debug stream
	void flush(std::ostream&);				// Copies the local buffer to a new stream ( cout for example )
	void log(const std::string&);				// Dump the log to a file
	std::ostream& operator<<(const std::string&);		// Debug info input operator
	static Debug& Instance();				// Instance fetch
	~Debug();						// Destructor
};
/*********************************************************/
#endif // DEBUG_STREAMS_H_